import json

# with open("output_backup.txxt",mode='r',) as f :
#     lines = f.readlines()

# with open("o.txt",mode='w') as f2 :
#     for line in lines:
#         f2.write(json.dumps(json.loads(line),ensure_ascii=False))
#         f2.write("\n")

cnt1 =  0
cnt2 = 0 

with open("output_with_colbert.txt",mode='r') as f :
    lines = f.readlines()
    for line in lines :
        line = json.loads(line)
        print(line.keys())
        pred = line['pred']
        if pred[0] == 1 :
            cnt1 +=1 
        if pred[1] == 1:
            cnt2 +=1
    print(f"定界正确比例 {cnt1/len(lines)} 根因正确{cnt2 / len(lines)} " )